{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "34b3fcc1",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import os\n",
    "import math"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "8a5c9b03",
   "metadata": {},
   "outputs": [],
   "source": [
    "results = pd.read_csv('Batch_4655371_batch_results.csv')\n",
    "uids = pd.read_csv(\n",
    "    '../final/youtubemix-unconditional-16s-exp-1/uids.txt', \n",
    "    sep=' ', \n",
    "    header=None, \n",
    "    names=['method', 'filename','uid'],\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "71abd2be",
   "metadata": {},
   "outputs": [],
   "source": [
    "responses = []\n",
    "for col in results.columns:\n",
    "    if col.startswith('Input'):\n",
    "        index = int(col.split(\"_\")[-2])\n",
    "        responses.append(\n",
    "            results[\n",
    "                [col, f'Answer.recording_{index}_musicality', f'Answer.recording_{index}_quality', 'WorkerId']\n",
    "            ]\n",
    "        )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "ecaa27ea",
   "metadata": {},
   "outputs": [],
   "source": [
    "responses = [e.rename(columns=dict(zip(e.columns, ['url', 'musicality', 'quality', 'worker']))) for e in responses]\n",
    "responses = pd.concat(responses, axis=0)\n",
    "responses['uid'] = responses['url'].apply(lambda x: x.split(\"/\")[-1].replace(\".wav\", \"\"))\n",
    "responses = responses[['uid', 'worker', 'quality', 'musicality']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "8e59128f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>uid</th>\n",
       "      <th>worker</th>\n",
       "      <th>quality</th>\n",
       "      <th>musicality</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>21e150949efee464da90f534a23d4c9d</td>\n",
       "      <td>A175PJR0W3LO8I</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>21e150949efee464da90f534a23d4c9d</td>\n",
       "      <td>A18LFH7XW61JO9</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>21e150949efee464da90f534a23d4c9d</td>\n",
       "      <td>A1IHI23KH87K5W</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>21e150949efee464da90f534a23d4c9d</td>\n",
       "      <td>A1NF6PELRKACS9</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>21e150949efee464da90f534a23d4c9d</td>\n",
       "      <td>A1WY3YGT618GC0</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>595</th>\n",
       "      <td>d480865f9b38fe803042e325a28f5ab0</td>\n",
       "      <td>A3N7R7P9HP2YB6</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>596</th>\n",
       "      <td>d480865f9b38fe803042e325a28f5ab0</td>\n",
       "      <td>A3O2JUIF4DZQJU</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>597</th>\n",
       "      <td>d480865f9b38fe803042e325a28f5ab0</td>\n",
       "      <td>A3QZMGTVA4VO44</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>598</th>\n",
       "      <td>d480865f9b38fe803042e325a28f5ab0</td>\n",
       "      <td>AE861G0AY5RGT</td>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>599</th>\n",
       "      <td>d480865f9b38fe803042e325a28f5ab0</td>\n",
       "      <td>APSN3KV49VLKX</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>3000 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                  uid          worker  quality  musicality\n",
       "0    21e150949efee464da90f534a23d4c9d  A175PJR0W3LO8I        2           3\n",
       "1    21e150949efee464da90f534a23d4c9d  A18LFH7XW61JO9        4           2\n",
       "2    21e150949efee464da90f534a23d4c9d  A1IHI23KH87K5W        3           2\n",
       "3    21e150949efee464da90f534a23d4c9d  A1NF6PELRKACS9        3           2\n",
       "4    21e150949efee464da90f534a23d4c9d  A1WY3YGT618GC0        3           2\n",
       "..                                ...             ...      ...         ...\n",
       "595  d480865f9b38fe803042e325a28f5ab0  A3N7R7P9HP2YB6        3           2\n",
       "596  d480865f9b38fe803042e325a28f5ab0  A3O2JUIF4DZQJU        2           2\n",
       "597  d480865f9b38fe803042e325a28f5ab0  A3QZMGTVA4VO44        3           3\n",
       "598  d480865f9b38fe803042e325a28f5ab0   AE861G0AY5RGT        4           3\n",
       "599  d480865f9b38fe803042e325a28f5ab0   APSN3KV49VLKX        3           3\n",
       "\n",
       "[3000 rows x 4 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "responses"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "268e6a7b",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.merge(responses, uids, on='uid', how='inner')\n",
    "data = data.sort_values(['filename', 'method'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "d1053558",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>uid</th>\n",
       "      <th>worker</th>\n",
       "      <th>quality</th>\n",
       "      <th>musicality</th>\n",
       "      <th>method</th>\n",
       "      <th>filename</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1140</th>\n",
       "      <td>ec3aa314da9bb01779c147c719a5711b</td>\n",
       "      <td>A18LFH7XW61JO9</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>samplernn-3</td>\n",
       "      <td>0.wav</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1141</th>\n",
       "      <td>ec3aa314da9bb01779c147c719a5711b</td>\n",
       "      <td>A1IHI23KH87K5W</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>samplernn-3</td>\n",
       "      <td>0.wav</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1142</th>\n",
       "      <td>ec3aa314da9bb01779c147c719a5711b</td>\n",
       "      <td>A1NF6PELRKACS9</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>samplernn-3</td>\n",
       "      <td>0.wav</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1143</th>\n",
       "      <td>ec3aa314da9bb01779c147c719a5711b</td>\n",
       "      <td>A1S88VQY8G8CNC</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>samplernn-3</td>\n",
       "      <td>0.wav</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1144</th>\n",
       "      <td>ec3aa314da9bb01779c147c719a5711b</td>\n",
       "      <td>A1WY3YGT618GC0</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>samplernn-3</td>\n",
       "      <td>0.wav</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1415</th>\n",
       "      <td>12e0c8b2bad640fb19488dec4f65d4d9</td>\n",
       "      <td>A3N7R7P9HP2YB6</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>wavenet-1024</td>\n",
       "      <td>9.wav</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1416</th>\n",
       "      <td>12e0c8b2bad640fb19488dec4f65d4d9</td>\n",
       "      <td>A3QZMGTVA4VO44</td>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>wavenet-1024</td>\n",
       "      <td>9.wav</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1417</th>\n",
       "      <td>12e0c8b2bad640fb19488dec4f65d4d9</td>\n",
       "      <td>AA7BTDZQNHW5</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>wavenet-1024</td>\n",
       "      <td>9.wav</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1418</th>\n",
       "      <td>12e0c8b2bad640fb19488dec4f65d4d9</td>\n",
       "      <td>AISFU4P55HYEH</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>wavenet-1024</td>\n",
       "      <td>9.wav</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1419</th>\n",
       "      <td>12e0c8b2bad640fb19488dec4f65d4d9</td>\n",
       "      <td>APSN3KV49VLKX</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>wavenet-1024</td>\n",
       "      <td>9.wav</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>3000 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                   uid          worker  quality  musicality  \\\n",
       "1140  ec3aa314da9bb01779c147c719a5711b  A18LFH7XW61JO9        4           2   \n",
       "1141  ec3aa314da9bb01779c147c719a5711b  A1IHI23KH87K5W        3           2   \n",
       "1142  ec3aa314da9bb01779c147c719a5711b  A1NF6PELRKACS9        3           1   \n",
       "1143  ec3aa314da9bb01779c147c719a5711b  A1S88VQY8G8CNC        3           1   \n",
       "1144  ec3aa314da9bb01779c147c719a5711b  A1WY3YGT618GC0        4           1   \n",
       "...                                ...             ...      ...         ...   \n",
       "1415  12e0c8b2bad640fb19488dec4f65d4d9  A3N7R7P9HP2YB6        3           3   \n",
       "1416  12e0c8b2bad640fb19488dec4f65d4d9  A3QZMGTVA4VO44        4           3   \n",
       "1417  12e0c8b2bad640fb19488dec4f65d4d9    AA7BTDZQNHW5        4           4   \n",
       "1418  12e0c8b2bad640fb19488dec4f65d4d9   AISFU4P55HYEH        2           3   \n",
       "1419  12e0c8b2bad640fb19488dec4f65d4d9   APSN3KV49VLKX        4           2   \n",
       "\n",
       "            method filename  \n",
       "1140   samplernn-3    0.wav  \n",
       "1141   samplernn-3    0.wav  \n",
       "1142   samplernn-3    0.wav  \n",
       "1143   samplernn-3    0.wav  \n",
       "1144   samplernn-3    0.wav  \n",
       "...            ...      ...  \n",
       "1415  wavenet-1024    9.wav  \n",
       "1416  wavenet-1024    9.wav  \n",
       "1417  wavenet-1024    9.wav  \n",
       "1418  wavenet-1024    9.wav  \n",
       "1419  wavenet-1024    9.wav  \n",
       "\n",
       "[3000 rows x 6 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "df04fd3d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Discard Worker IDs: {'A2OZ5SOGNN9QOA', 'A3M3HUU77NKTES', 'APSN3KV49VLKX', 'A2TG7EEQ2XG2IK', 'A38DC3BG1ZCVZ2', 'A1NOINYD1FZ55T'}\n"
     ]
    }
   ],
   "source": [
    "# Quality check: workers should not give ratings higher than those indicated\n",
    "control_files = {\n",
    "    '4.wav': (2, 2), \n",
    "    '10.wav': (2, 2), \n",
    "    '15.wav': (5, 2), \n",
    "    '17.wav': (2, 2), \n",
    "    '21.wav': (2, 2), \n",
    "}\n",
    "blocklist = set()\n",
    "for control, (expected_quality, expected_musicality) in control_files.items():\n",
    "    df = data[(data['method'] == 'test') & (data['filename'] == control)][['worker', 'quality', 'musicality']]\n",
    "    blocklist = blocklist.union(set(df[(df['quality'] > expected_quality) | (df['musicality'] > expected_musicality)]['worker']))\n",
    "print(\"Discard Worker IDs:\", blocklist)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "83d6ffa9",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Remove workers from data\n",
    "clean_data = data[~data['worker'].isin(blocklist)]\n",
    "# Remove test examples\n",
    "data = data[~((data['method'] == 'test') & (data['filename'].isin(list(control_files.keys()))))]\n",
    "clean_data = clean_data[~((clean_data['method'] == 'test') & (clean_data['filename'].isin(list(control_files.keys()))))]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "7db225e0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>quality</th>\n",
       "      <th>musicality</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>method</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>samplernn-3</th>\n",
       "      <td>2.976967</td>\n",
       "      <td>1.821497</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>sashimi-2</th>\n",
       "      <td>2.428023</td>\n",
       "      <td>2.420345</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>sashimi-8</th>\n",
       "      <td>2.854127</td>\n",
       "      <td>3.113244</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>test</th>\n",
       "      <td>3.755708</td>\n",
       "      <td>4.593607</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>wavenet-1024</th>\n",
       "      <td>2.909789</td>\n",
       "      <td>2.714012</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               quality  musicality\n",
       "method                            \n",
       "samplernn-3   2.976967    1.821497\n",
       "sashimi-2     2.428023    2.420345\n",
       "sashimi-8     2.854127    3.113244\n",
       "test          3.755708    4.593607\n",
       "wavenet-1024  2.909789    2.714012"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "clean_data.groupby(['method']).mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "740d2b21",
   "metadata": {},
   "outputs": [],
   "source": [
    "def calc_stats(df, col):\n",
    "    stats = df.groupby(['method'])[col].agg(['mean', 'count', 'std'])\n",
    "    ci95_hi = []\n",
    "    ci95_lo = []\n",
    "\n",
    "    for i in stats.index:\n",
    "        m, c, s = stats.loc[i]\n",
    "        ci95_hi.append(m + 1.96*s/math.sqrt(c))\n",
    "        ci95_lo.append(m - 1.96*s/math.sqrt(c))\n",
    "\n",
    "    stats['ci95_hi'] = ci95_hi\n",
    "    stats['ci95_lo'] = ci95_lo\n",
    "    return stats"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "0b84cea9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>mean</th>\n",
       "      <th>count</th>\n",
       "      <th>std</th>\n",
       "      <th>ci95_hi</th>\n",
       "      <th>ci95_lo</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>method</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>samplernn-3</th>\n",
       "      <td>2.98</td>\n",
       "      <td>521</td>\n",
       "      <td>0.98</td>\n",
       "      <td>3.06</td>\n",
       "      <td>2.89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>sashimi-2</th>\n",
       "      <td>2.43</td>\n",
       "      <td>521</td>\n",
       "      <td>0.89</td>\n",
       "      <td>2.50</td>\n",
       "      <td>2.35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>sashimi-8</th>\n",
       "      <td>2.85</td>\n",
       "      <td>521</td>\n",
       "      <td>0.96</td>\n",
       "      <td>2.94</td>\n",
       "      <td>2.77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>test</th>\n",
       "      <td>3.76</td>\n",
       "      <td>438</td>\n",
       "      <td>0.95</td>\n",
       "      <td>3.84</td>\n",
       "      <td>3.67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>wavenet-1024</th>\n",
       "      <td>2.91</td>\n",
       "      <td>521</td>\n",
       "      <td>0.92</td>\n",
       "      <td>2.99</td>\n",
       "      <td>2.83</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              mean  count   std  ci95_hi  ci95_lo\n",
       "method                                           \n",
       "samplernn-3   2.98    521  0.98     3.06     2.89\n",
       "sashimi-2     2.43    521  0.89     2.50     2.35\n",
       "sashimi-8     2.85    521  0.96     2.94     2.77\n",
       "test          3.76    438  0.95     3.84     3.67\n",
       "wavenet-1024  2.91    521  0.92     2.99     2.83"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "calc_stats(clean_data, 'quality').round(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "31867a1b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>mean</th>\n",
       "      <th>count</th>\n",
       "      <th>std</th>\n",
       "      <th>ci95_hi</th>\n",
       "      <th>ci95_lo</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>method</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>samplernn-3</th>\n",
       "      <td>1.82</td>\n",
       "      <td>521</td>\n",
       "      <td>0.88</td>\n",
       "      <td>1.90</td>\n",
       "      <td>1.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>sashimi-2</th>\n",
       "      <td>2.42</td>\n",
       "      <td>521</td>\n",
       "      <td>0.91</td>\n",
       "      <td>2.50</td>\n",
       "      <td>2.34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>sashimi-8</th>\n",
       "      <td>3.11</td>\n",
       "      <td>521</td>\n",
       "      <td>0.95</td>\n",
       "      <td>3.20</td>\n",
       "      <td>3.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>test</th>\n",
       "      <td>4.59</td>\n",
       "      <td>438</td>\n",
       "      <td>0.70</td>\n",
       "      <td>4.66</td>\n",
       "      <td>4.53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>wavenet-1024</th>\n",
       "      <td>2.71</td>\n",
       "      <td>521</td>\n",
       "      <td>0.85</td>\n",
       "      <td>2.79</td>\n",
       "      <td>2.64</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              mean  count   std  ci95_hi  ci95_lo\n",
       "method                                           \n",
       "samplernn-3   1.82    521  0.88     1.90     1.75\n",
       "sashimi-2     2.42    521  0.91     2.50     2.34\n",
       "sashimi-8     3.11    521  0.95     3.20     3.03\n",
       "test          4.59    438  0.70     4.66     4.53\n",
       "wavenet-1024  2.71    521  0.85     2.79     2.64"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "calc_stats(clean_data, 'musicality').round(2)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
